package com.ruoyi.rsikManage.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.rsikManage.domain.TRiskWarningDisposal;
import com.ruoyi.rsikManage.service.ITRiskWarningDisposalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.servlet.http.HttpServletResponse;

/**
 * 风险预警处置信息Controller
 * 
 * @author wu
 * @date 2023-08-29
 */
@RestController
@RequestMapping("/zdzh/tRiskWarningDisposal")
public class TRiskWarningDisposalController extends BaseController
{
    @Autowired
    private ITRiskWarningDisposalService tRiskWarningDisposalService;

    /**
     * 查询风险预警处置信息列表
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:list')")
    @GetMapping("/list")
    public TableDataInfo list(TRiskWarningDisposal tRiskWarningDisposal)
    {
        startPage();
        List<TRiskWarningDisposal> list = tRiskWarningDisposalService.selectTRiskWarningDisposalList(tRiskWarningDisposal);
        return getDataTable(list);
    }

    /**
     * 导出风险预警处置信息列表
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:export')")
    @Log(title = "风险预警处置信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public void export(HttpServletResponse response,TRiskWarningDisposal tRiskWarningDisposal)
    {
        List<TRiskWarningDisposal> list = tRiskWarningDisposalService.selectTRiskWarningDisposalList(tRiskWarningDisposal);
        ExcelUtil<TRiskWarningDisposal> util = new ExcelUtil<TRiskWarningDisposal>(TRiskWarningDisposal.class);
         util.exportExcel(response,list, "tRiskWarningDisposal");
    }

    /**
     * 获取风险预警处置信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tRiskWarningDisposalService.selectTRiskWarningDisposalById(id));
    }

    /**
     * 新增风险预警处置信息
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:add')")
    @Log(title = "风险预警处置信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TRiskWarningDisposal tRiskWarningDisposal)
    {
        return toAjax(tRiskWarningDisposalService.insertTRiskWarningDisposal(tRiskWarningDisposal));
    }

    /**
     * 修改风险预警处置信息
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:edit')")
    @Log(title = "风险预警处置信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TRiskWarningDisposal tRiskWarningDisposal)
    {
        return toAjax(tRiskWarningDisposalService.updateTRiskWarningDisposal(tRiskWarningDisposal));
    }

    /**
     * 删除风险预警处置信息
     */
    //@PreAuthorize("@ss.hasPermi('zdzh:tRiskWarningDisposal:remove')")
    @Log(title = "风险预警处置信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tRiskWarningDisposalService.deleteTRiskWarningDisposalByIds(ids));
    }
}
